package main

import "fmt"

func main() {
	myprint("main start....")
	defer func() {
		if msg := recover(); msg != nil {
			fmt.Println(msg, "程序回复啦")
		}
	}()
	funA()
	funB()
	fmt.Println("man over。。。。。")
}

func myprint(s string) {
	fmt.Println(s)
}

func funA() {
	fmt.Println("我是一个函数funA()")
}

func funB() {
	//defer func() {
	//	if msg := recover(); msg != nil {
	//		fmt.Println(msg, "程序回复啦")
	//	}
	//}()
	fmt.Println("funB start...")
	defer myprint("defer funB().....1...")
	for i := 1; i <= 10; i++ {
		fmt.Println(i)
		if i == 5 {
			panic("==5, panic")
		}
	}
	fmt.Println("panic之后的不会执行了")
	defer myprint("defer funB().....2....")
}
